const base_url='https://api-hmugo-web.itheima.net/api/public/v1'
export const myrequest=(option)=>{
  return new Promise((resolve,reject)=>{
    uni.request({
      url:base_url+option.url,
      method:option.method || 'GET',
      data:option.data || {},
      success:res=>{
        if(res.data.meta.status !==200){
          return uni.showToast({
            title:'获取数据失败'
          })
        }
        resolve(res)
      },
      fail:err=>{
        uni.showToast({
          title:'请求接口失败'
        })
        reject(err)
      }
    })
  })
}